<?php

namespace app\middleware;

class Required
{
    public function handle($request, \Closure $next,$type)
    {
        $param = $request->param();
        foreach ($type as $v){
            if(!array_key_exists($v,$param) || $param[$v]==''){
                return json([
                    'code'=>1002,
                    'msg'=>$v .' require'
                ]);
                break;
            }
        }
        return $next($request);
    }
}
